using System;
using System.Threading.Tasks;
using SheLife.Domain.Entities;

namespace SheLife.Domain.Interfaces.Repositories
{
    /// <summary>
    /// 用户权限仓储接口
    /// </summary>
    public interface IUserPermissionRepository : IRepository<UserPermission>
    {
        /// <summary>
        /// 根据用户ID获取用户权限列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>用户权限列表</returns>
        Task<IEnumerable<UserPermission>> GetByUserIdAsync(Guid userId);

        /// <summary>
        /// 根据权限ID获取用户权限列表
        /// </summary>
        /// <param name="permissionId">权限ID</param>
        /// <returns>用户权限列表</returns>
        Task<IEnumerable<UserPermission>> GetByPermissionIdAsync(Guid permissionId);

        /// <summary>
        /// 根据用户ID和权限ID获取用户权限
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="permissionId">权限ID</param>
        /// <returns>用户权限</returns>
        Task<UserPermission> GetByUserIdAndPermissionIdAsync(Guid userId, Guid permissionId);

        /// <summary>
        /// 检查用户是否拥有指定权限
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="permissionCode">权限编码</param>
        /// <returns>是否拥有权限</returns>
        Task<bool> CheckUserHasPermissionAsync(Guid userId, string permissionCode);

        /// <summary>
        /// 获取用户的权限列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>权限列表</returns>
        Task<IEnumerable<SystemPermission>> GetUserPermissionsAsync(Guid userId);

        /// <summary>
        /// 批量为用户分配权限
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="permissionIds">权限ID列表</param>
        /// <returns>执行结果</returns>
        Task<bool> AssignPermissionsToUserAsync(Guid userId, IEnumerable<Guid> permissionIds);

        /// <summary>
        /// 批量移除用户的权限
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="permissionIds">权限ID列表</param>
        /// <returns>执行结果</returns>
        Task<bool> RemovePermissionsFromUserAsync(Guid userId, IEnumerable<Guid> permissionIds);
    }
}